#include "httputils.h"

HttpUtils::HttpUtils(QObject *parent) :
        QObject(parent) {
    manager = new QNetworkAccessManager(this);
    QNetworkAccessManager::connect(manager, &QNetworkAccessManager::finished, this, &HttpUtils::replyFinished);
}

void HttpUtils::replyFinished(QNetworkReply *reply) {
    emit onReplySignal(reply->readAll());
}

void HttpUtils::connect(QString url) {
    QNetworkRequest request;
    request.setUrl(QUrl(BASE_URL + url));
    manager->get(request);
}

HttpUtils::~HttpUtils() {
    // 这里可以进行必要的清理工作
}
